#!/bin/sh

for i in $PLIBDIRS # $PLIBDIRS is exported in 2createpackages
do
	[ -d $i ] || continue
	LIBCRYPTO="`ls -1 ${i}/libcrypto.so.* 2>/dev/null | head -n 1`"
	if [ "$LIBCRYPTO" ];then
		LIBCRYPTO=${LIBCRYPTO##*/} #"`basename $LIBCRYPTO`"
		ln -sv $LIBCRYPTO ${i}/libcrypto.so.0
		ln -sv $LIBCRYPTO ${i}/libcrypto.so.0.9.7
		ln -sv $LIBCRYPTO ${i}/libcrypto.so.0.9.8
		ln -sv $LIBCRYPTO ${i}/libcrypto.so.1.0.0
	fi
	LIBSSL="`ls -1 ${i}/libssl.so.* 2>/dev/null | head -n 1`"
	if [ "$LIBSSL" ];then
		LIBSSL=${LIBSSL##*/} #"`basename $LIBSSL`"
		ln -sv $LIBSSL ${i}/libssl.so.0
		ln -sv $LIBSSL ${i}/libssl.so.0.9.7
		ln -sv $LIBSSL ${i}/libssl.so.0.9.8
		ln -sv $LIBSSL ${i}/libssl.so.1.0.0
	fi
	#[ -d ${i}/engines ] && rm -rf ${i}/engines
done

#rm -rf usr/bin
